package atm;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.security.PublicKey;

/**
 * 查询界面
 */
public class SearchPanel extends JPanel implements ActionListener {
    private ATMFrame atmFrame;
    private ImageIcon savepane = new ImageIcon("Tu/buttonFind.jpg");
    private JLabel accountLabel = new JLabel("查询余额");
    private JTextField accountField = new JTextField();
    private Font font = new Font("黑体", Font.BOLD, 30);    //字体

    private JButton loginBtn = new JButton(savepane);      //声明






    public SearchPanel(ATMFrame atmFrame){
        this.atmFrame=atmFrame;
        this.setLayout(null);
        accountLabel.setBounds(300, 200, 200, 50); //余额坐标
        accountLabel.setFont(font);
        accountField.setBounds(450, 200, 250, 50);
        accountLabel.setFont(font);

        loginBtn.setBounds(700, 350, 140, 50);    //按钮坐标
        loginBtn.addActionListener(this);
        accountLabel.setFont(font);


        this.add(loginBtn);         //输出
        this.add(accountLabel);
        this.add(accountField);


        this.setOpaque(false);
    }
    public void showBlance(){
        accountField.setText(""  +atmFrame.getLoginUser().getBlance());
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource()==savepane){

            atmFrame.switchPanel("menu");
        }

    }
}
